package io;

import java.io.*;

/**
 * java将流按照读写单位划分为字节与字符流
 * 字节流:InputStream和OutputStream
 *
 */
public class OSWDemo {
    public static void main(String[] args) throws IOException {
        //向文件osw.txt中写入文本数据
        FileOutputStream fos = new FileOutputStream("osw.txtx");
        //创建转换流时通常要明确
        OutputStreamWriter osw = new OutputStreamWriter(fos);
//
//        String line = "让我再看你一眼从南到北";
//        String line2 = "像是被五环路蒙住了双眼";
//        byte[] data = line.getBytes(StandardCharsets.UTF_8);
//        fos.write(data);
//        fos.write("像是被五环路蒙住的双眼。".getBytes(StandardCharsets.UTF_8));



        osw.write("让我再看你一眼,从南到北");
        osw.write("像是被五环路,蒙住了双眼");

        System.out.println("写出完毕");
        osw.close();

    }
}
